import random

num = random.randint(1, 100)
while True:
    guess = int(input("猜数字："))
    if 1 <= guess <= 100:
        if guess > num:
            print("大了")
        elif guess < num:
            print("小了")
        elif guess == num:
            print('恭喜中奖，本轮幸运数字为：', num)
            select = input('是否开始新的一轮:')
            if select == 'y':
                num= random.randint(1,100)
            elif select == 'n':
                break
    else:
        print("请输入1~100的数字")
